package org.util;

import java.util.Random;

/**
 * 
 * @ClassName:  RandomUtil   
 * @Description:TODO(随机数工具类)   
 * @author: shikong
 * @date:   2018年5月17日 下午2:55:36      
 * @Copyright: 2018
 */
public class RandomUtil {
	/**
	 * 
	 * @Title: getRandomString   
	 * @Description:生成一个不重复的随机数   
	 * @param: @param length
	 * @param: @return      
	 * @return: String      
	 * @throws
	 */
    public static String getRandomString(int length) { //length表示生成字符串的长度,没有大写O字母
        String base = "abcdefghijklmnopqrstuvwxyz0123456789QWERTYUIPASDFGHJKLZXCVBNM";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            int number = random.nextInt(base.length());
            sb.append(base.charAt(number));
        }
        return sb.toString();
    }

}
